package com.iplant.ams.service.po.ams.asset;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.ams.service.po.ams.fxt.DMSMeasureLedger;
import com.iplant.ams.service.po.dms.DMSDeviceLedger;
import com.iplant.ams.service.po.ams.fxt.DMSFrockLedger;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;

import java.io.Serializable;

/**
 * 资产清单
 */
@DBBasePO(TableName = "ams_asset_list", Schemas = DBSchemas.AMS, CheckName = {"Code"},
        CodeAuto = true, CodePrefix = "GDZC_{yyyyMM}_", CodeNum = 6)
public class AMSAssetInfo extends BasePO implements Serializable {

    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    /**
     * 标准型号ID
     */
    @DBCondition
    @DBField(CheckValue = true)
    public int StandardModelID = 0;

    /**
     * 标准型号名称
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String StandardModelName = "";

    /**
     * 标准型号编码
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String StandardModelCode = "";

    /**
     * 资产型号
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "AssetModel", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String AssetModel = "";

    /**
     * 资产分类ID
     */
    @DBCondition
    @DBJoin(name = "ClassificationID", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas =
            DBSchemas.AMS, MainTableField
            = "StandardModelID")
    public int ClassificationID = 0;

    /**
     * 资产分类名称
     */

    @DBJoin(name = "Name", tableName = "ams_asset_classification", tableAsName = "a2", Schemas = DBSchemas.AMS,
            JoinIndex = 2, ConditionalJoin
            = "a1.ClassificationID=a2.ID ")
    public String ClassificationName = "";

    /**
     * 资产分类Code
     */

    @DBJoin(name = "Code", tableName = "ams_asset_classification", tableAsName = "a2", Schemas = DBSchemas.AMS,
            JoinIndex = 2, ConditionalJoin
            = "a1.ClassificationID=a2.ID ")
    public String ClassificationCode = "";

    /**
     * 资产分类枚举
     */
    @DBCondition
    @DBJoin(name = "TypeEnum", tableName = "ams_asset_classification", tableAsName = "a2", Schemas = DBSchemas.AMS,
            JoinIndex = 2, ConditionalJoin
            = "a1.ClassificationID=a2.ID ")
    public int TypeEnum = 0;


    /**
     * 资产图片
     */
    @DBJoin(name = "AssetImage", tableName = "ams_asset_standard_model", tableAsName = "a1", Schemas = DBSchemas.AMS,
            MainTableField
                    = "StandardModelID")
    public String AssetModelImage = "";


    /**
     * 资产图片
     */
    @DBField
    public String AssetImage = "";

    /**
     * 当前状态
     */
    @DBField
    public int CurrentStatus = 0;

    /**
     * 当前使用人ID
     */
    @DBField
    public int KeepInUserID = 0;

    /**
     * 当前使用人姓名
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "u3", Schemas = DBSchemas.Basic, MainTableField = "KeepInUserID")
    public String KeepInUserName = "";

    /**
     * 序列号
     */
    @DBField
    public String AssetSN = "";

    /**
     * 入库单ID
     */
    @DBField
    public int StorageID = 0;

    /**
     * 供应商
     */
    @DBField
    public int SupplierID = 0;

    @DBJoin(name = "Name", tableName = "crm_customer", tableAsName = "c1", Schemas = DBSchemas.Basic, MainTableField
            = "SupplierID")
    public String SupplierName = "";

    @DBJoin(name = "Code", tableName = "crm_customer", tableAsName = "c1", Schemas = DBSchemas.Basic, MainTableField
            = "SupplierID")
    public String SupplierCode = "";


    public AMSAssetInfo() {
        super();
    }

    public void SetLedger(DMSDeviceLedger wDMSDeviceLedger){
        Name=wDMSDeviceLedger.Name;
        Code=wDMSDeviceLedger.Code;
        AssetSN=wDMSDeviceLedger.AssetNo;
        StandardModelID=wDMSDeviceLedger.StandardModelID;
        StandardModelName=wDMSDeviceLedger.StandardModelName;
        StandardModelCode=wDMSDeviceLedger.StandardModelCode;
        SupplierID=wDMSDeviceLedger.SupplierID;
        AssetImage=wDMSDeviceLedger.ImageIcon;
        Active=wDMSDeviceLedger.Active;
    }

    public AMSAssetInfo(DMSDeviceLedger wDMSDeviceLedger){
        super();
        ID=wDMSDeviceLedger.AssetInfoID;
        Name=wDMSDeviceLedger.Name;
        Code=wDMSDeviceLedger.Code;
        AssetSN=wDMSDeviceLedger.AssetNo;
        StandardModelID=wDMSDeviceLedger.StandardModelID;
        StandardModelName=wDMSDeviceLedger.StandardModelName;
        StandardModelCode=wDMSDeviceLedger.StandardModelCode;
        SupplierID=wDMSDeviceLedger.SupplierID;
        AssetImage=wDMSDeviceLedger.ImageIcon;
        Active=wDMSDeviceLedger.Active;
    }
    public void SetLedger(DMSFrockLedger wDMSFrockLedger){
        Name=wDMSFrockLedger.Name;
        Code=wDMSFrockLedger.Code;
        AssetSN=wDMSFrockLedger.AssetNo;
        StandardModelID=wDMSFrockLedger.StandardModelID;
        StandardModelName=wDMSFrockLedger.StandardModelName;
        StandardModelCode=wDMSFrockLedger.StandardModelCode;

        Active=wDMSFrockLedger.Active;
    }


    public AMSAssetInfo(DMSFrockLedger wDMSFrockLedger){
        super();
        ID=wDMSFrockLedger.AssetInfoID;
        Name=wDMSFrockLedger.Name;
        Code=wDMSFrockLedger.Code;
        AssetSN=wDMSFrockLedger.AssetNo;
        StandardModelID=wDMSFrockLedger.StandardModelID;
        StandardModelName=wDMSFrockLedger.StandardModelName;
        StandardModelCode=wDMSFrockLedger.StandardModelCode;

        Active=wDMSFrockLedger.Active;
    }

    public void SetLedger(DMSMeasureLedger wDMSMeasureLedger){
        Name=wDMSMeasureLedger.Name;
        Code=wDMSMeasureLedger.Code;
        AssetSN=wDMSMeasureLedger.AssetNo;
        StandardModelID=wDMSMeasureLedger.StandardModelID;
        StandardModelName=wDMSMeasureLedger.StandardModelName;
        StandardModelCode=wDMSMeasureLedger.StandardModelCode;

        Active=wDMSMeasureLedger.Active;
    }

    public AMSAssetInfo(DMSMeasureLedger wDMSFrockLedger){
        super();
        ID=wDMSFrockLedger.AssetInfoID;
        Name=wDMSFrockLedger.Name;
        Code=wDMSFrockLedger.Code;
        AssetSN=wDMSFrockLedger.AssetNo;
        StandardModelID=wDMSFrockLedger.StandardModelID;
        StandardModelName=wDMSFrockLedger.StandardModelName;
        StandardModelCode=wDMSFrockLedger.StandardModelCode;

        Active=wDMSFrockLedger.Active;
    }




    @JsonProperty("StandardModelID")
    public int getStandardModelID() {
        return StandardModelID;
    }

    public void setStandardModelID(int standardModelID) {
        StandardModelID = standardModelID;
    }

    @JsonProperty("StandardModelName")
    public String getStandardModelName() {
        return StandardModelName;
    }

    public void setStandardModelName(String standardModelName) {
        StandardModelName = standardModelName;
    }

    @JsonProperty("StandardModelCode")
    public String getStandardModelCode() {
        return StandardModelCode;
    }

    public void setStandardModelCode(String standardModelCode) {
        StandardModelCode = standardModelCode;
    }

    @JsonProperty("AssetModel")
    public String getAssetModel() {
        return AssetModel;
    }

    public void setAssetModel(String assetModel) {
        AssetModel = assetModel;
    }

    @JsonProperty("ClassificationID")
    public int getClassificationID() {
        return ClassificationID;
    }

    public void setClassificationID(int classificationID) {
        ClassificationID = classificationID;
    }

    @JsonProperty("ClassificationName")
    public String getClassificationName() {
        return ClassificationName;
    }

    public void setClassificationName(String classificationName) {
        ClassificationName = classificationName;
    }

    @JsonProperty("ClassificationCode")
    public String getClassificationCode() {
        return ClassificationCode;
    }

    public void setClassificationCode(String classificationCode) {
        ClassificationCode = classificationCode;
    }

    @JsonProperty("TypeEnum")
    public int getTypeEnum() {
        return TypeEnum;
    }

    public void setTypeEnum(int typeEnum) {
        TypeEnum = typeEnum;
    }

    @JsonProperty("AssetModelImage")
    public String getAssetModelImage() {
        return AssetModelImage;
    }

    public void setAssetModelImage(String assetModelImage) {
        AssetModelImage = assetModelImage;
    }

    @JsonProperty("AssetImage")
    public String getAssetImage() {
        return AssetImage;
    }

    public void setAssetImage(String assetImage) {
        AssetImage = assetImage;
    }

    @JsonProperty("CurrentStatus")
    public int getCurrentStatus() {
        return CurrentStatus;
    }

    public void setCurrentStatus(int currentStatus) {
        CurrentStatus = currentStatus;
    }

    @JsonProperty("KeepInUserID")
    public int getKeepInUserID() {
        return KeepInUserID;
    }

    public void setKeepInUserID(int keepInUserID) {
        KeepInUserID = keepInUserID;
    }

    @JsonProperty("KeepInUserName")
    public String getKeepInUserName() {
        return KeepInUserName;
    }

    public void setKeepInUserName(String keepInUserName) {
        KeepInUserName = keepInUserName;
    }

    @JsonProperty("AssetSN")
    public String getAssetSN() {
        return AssetSN;
    }

    public void setAssetSN(String assetSN) {
        AssetSN = assetSN;
    }

    @JsonProperty("StorageID")
    public int getStorageID() {
        return StorageID;
    }

    public void setStorageID(int storageID) {
        StorageID = storageID;
    }

    @JsonProperty("SupplierID")
    public int getSupplierID() {
        return SupplierID;
    }

    public void setSupplierID(int supplierID) {
        SupplierID = supplierID;
    }

    @JsonProperty("SupplierName")
    public String getSupplierName() {
        return SupplierName;
    }

    public void setSupplierName(String supplierName) {
        SupplierName = supplierName;
    }

    @JsonProperty("SupplierCode")
    public String getSupplierCode() {
        return SupplierCode;
    }

    public void setSupplierCode(String supplierCode) {
        SupplierCode = supplierCode;
    }
}
